package com.xiaotu.server.service.guduo;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.xiaotu.common.model.GuDuoExceptionRecordModel;
import com.xiaotu.common.model.GuDuoPublicOpinionDataModel;
import com.xiaotu.common.model.GuDuoRecordDataModel;
import com.xiaotu.common.model.TvInfoSpiderTempModel;
import com.xiaotu.server.service.BaseService;

@Service
public class SupplementGuDuoRecordService extends BaseService{

	@Override
	protected String getKey() {
		return "GuoDuoMapper";
	}
	
	//记录爬取异常数据
	public int saveRecordSpiderExceptionData(List<GuDuoExceptionRecordModel> paramList){
		return this.update("saveRecordSpiderExceptionData",paramList);
	}

	public List<GuDuoExceptionRecordModel> queryExceptionRequestList() {
		return this.getList("queryExceptionRequestList");
	}

	public void updateDataList(List<GuDuoExceptionRecordModel> updExceptionRecordList,
			List<GuDuoRecordDataModel> updRecordDataList,
			List<GuDuoPublicOpinionDataModel> addGuDuoPublicOpinionDataList,
			List<GuDuoPublicOpinionDataModel> updGuDuoPublicOpinionDataList) {
		if(updExceptionRecordList.size()>0){
			this.update("batchUpdExceptionRecordList", updExceptionRecordList);
		}
		if(updRecordDataList.size()>0){
			this.update("batchUpdRecordDataList", updRecordDataList);
		}
		if(addGuDuoPublicOpinionDataList.size()>0){
			this.update("addGuDuoPublicOpinionDataList", addGuDuoPublicOpinionDataList);
		}
		if(updGuDuoPublicOpinionDataList.size()>0){
			this.update("updGuDuoPublicOpinionDataList", updGuDuoPublicOpinionDataList);
		}
	}
	
	public int getPublicOpinion(GuDuoExceptionRecordModel m){
		List<GuDuoPublicOpinionDataModel> list = this.getList("getPublicOpinion", m);
		if(null == list || list.isEmpty()){
			return 0;
		}
		return list.size();
	}
	
	public List<TvInfoSpiderTempModel> queryTvInfoSpiderTempDataIsNoSupplementList(Map<String,Object> paramMap){
		return this.getList("queryTvInfoSpiderTempDataIsNoSupplementList",paramMap);
	}
	
	//临时补充骨朵基本信息数据
	public int saveTvInfoSpiderTempData(List<TvInfoSpiderTempModel> list){
		return this.update("saveTvInfoSpiderTempData",list);
	}
	
	//查询存在于记录表中的数据
	public TvInfoSpiderTempModel queryisExitsSpiderTemp(Map<String,Object> paramMap){
		return this.get("queryisExitsSpiderTemp", paramMap);
	}
	
	//获取网大上映日期至今未到210天的
	public List<TvInfoSpiderTempModel> queryNotYetAchievedCycleDate(Map<String, Object> resourcesiteidMap) {
		return this.getList("queryNotYetAchievedCycleDate", resourcesiteidMap);
	}
	//用于爬取网大播放量
	public List<Map<String,Object>> getGuDuoNetMovieList(Map<String,Object> param) {
		return this.getList("getGuDuoNetMovieList",param);
	}
	
	public List<Map<String,Object>> getStarInfoList() {
		return this.getList("queryStarInfo");
	}

	public List<Map<String,Object>> getAllStarInfoList(Map<String,Object> param) {
		return this.getList("queryAllStarInfo",param);
	}

	public List<Map<String,Object>> getAllTvInfoList(Map<String,Object> param) {
		return this.getList("queryAllTvInfo",param);
	}
	public List<Map<String,Object>> queryStarBirthdayInfoList(Map<String,Object> param) {
		return this.getList("queryStarBirthdayInfo",param);
	}
	public List<Map<String,Object>> queryNotWorkStarInfo(Map<String,Object> param) {
		return this.getList("queryNotWorkStarInfo",param);
	}

	public List<Map<String,Object>> queryTVBaikeWorkInfo(Map<String,Object> param) {
		return this.getList("queryTVBaikeWorkInfo",param);
	}
}
